Concurrency with Modern C++ by Rainer Grimm

Concurrency with Modern C++ by Rainer Grimm

Author:Rainer Grimm [Rainer Grimm]
Language: eng
Format: epub, pdf, mobi
Publisher: leanpub.com
Published: 2017-06-20T00:00:00+00:00


The numbers give a clear indication. The Meyers Singleton is the fastest one. It is not only the fastest one, but it is also the easiest one to get. The Meyers Singleton is about two times faster than the atomic versions. As expected the synchronisation with the lock is the most heavyweight and, therefore, the slowest. std::call_once in particular on Windows is a lot slower than on Linux.

Performance of all singleton implementations Operating System (Compiler) Single Threaded Meyers Singleton std::lock_guard std::call_once Sequential Consistency Acquire-Release Semantic

Linux (GCC) 0.03 0.04 12.47 0.22 0.09 0.07

Windows (cl.exe) 0.02 0.03 15.48 1.74 0.07 0.07

I want to stress one point about the numbers explicitly. These are the summed up numbers for all four threads. That means that we get optimal concurrency with the Meyers Singleton because the Meyers Singleton is nearly as fast as the single threaded implementation.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.